﻿using HBKY.Shop.Common;
using HBKY.Shop.Common.PollyHelper;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace HBKY.Shop.Service
{
    /// <summary>
    /// httpclient 调用基类
    /// </summary>
    public abstract class BaseApiService
    {
        internal readonly HttpClient _httpClient;
        public BaseApiService(IHttpClientFactory httpClientFactory)
        {
            _httpClient = httpClientFactory.CreateClient();
        }

        /// <summary>
        /// 获取数据
        /// </summary>
        public async Task<T> Get<T>(string url) where T : class, new()
        {
            return await RequestApiProxy.Get<T>(_httpClient, url);
        }
    }
}
